Unicode Support
The Sybase Wire Protocol driver supports Unicode if the Sybase data source you are using to connect to the database is configured to use the UTF-8 character set. The data source is configured to use the UTF-8 character set by either setting the Charset attribute to UTF-8 in the connection string or in the odbc.ini file. See Table 2-1 for more information about the Charset attribute.
If the UTF-8 character set is installed, the driver maps the Sybase data types as follows:
Sybase Data Type Mapped to. . . Char SQL_WCHAR Unichar SQL_WCHAR Univarchar SQL_WVARCHAR Varchar SQL_WVARCHAR Text SQL_WLONGVARCHAR
This driver supports the Unicode ODBC W (Wide) function calls, such as SQLConnectW. This allows the Driver Manager to transmit these calls directly to the driver. Otherwise, the Driver Manager would incur the additional overhead of converting the W calls to ANSI function calls, and vice versa.
Default Unicode Mapping
The default Unicode mapping for an application’s SQL_C_WCHAR variable is UCS-2
Connection Attribute for Unicode
A connection attribute is available to support Unicode. This attribute determines how character data is converted and presented to an application and the database
Attribute Description SQL_ATTR_APP_WCHAR_TYPE (1061) Sets the SQL_C_WCHAR type for parameter and column binding to the desired unicode type. SQL_DD_CP_UCS2 is the default for Windows.
You can set this connection attribute either before or after a connection is made. If the attribute is changed after a connection is established, all conversions use the new values. The driver verifies multiple times during the connection that the connection attribute is set. Conversions are made based on the current application and database settings.
If a driver does not support Unicode, SQLGetConnect Attr and SQLSetConnectAttr return HYC00.
This connection attribute and its valid values can be found in the file qesqlext.h, which is installed with the driver.